Imports System.Windows.Forms
Imports dao
 Imports System.Data
Imports DTO
Public Class DANGKYHOCBus
Inherits AbstractBus
 Public Sub New()
 End Sub
 Public Sub New(ByVal ConnectionString As KetNoiDto)
 ketnoi = ConnectionString
 End Sub
 #Region "Xử Lý" 
 Public Sub Them(ByVal Dto As DANGKYHOCDto)
 Dim Dao As New DANGKYHOCDao(ketnoi)
 Dao.Them(Dto)
 End Sub
 Public Sub Xoa( ByVal IDDANGKYHOC As System.Int32)
 Dim Dao As New DANGKYHOCDao(ketnoi)
 Dao.xoa(IDDANGKYHOC)
 End Sub
 Public Sub sua(ByVal Dto As DANGKYHOCDto)
 Dim Dao As New DANGKYHOCDao(ketnoi)
 Dao.sua(Dto)
 End Sub
 #End Region 
 Public Function LayBangTable() As DataTable
 Dim Dao As New DANGKYHOCDao(ketnoi)
 dao.laybang()
 Return Dao
 End Function
 Public Function LayBangTableIlist() As IList
 Dim Dao As New DANGKYHOCDao(ketnoi)
 Dim aList As New ArrayList 
 For i As Integer = 0 To Dao.Rows.Count - 1 
 Dim dtoDANGKYHOC As DANGKYHOCdto = LayBangDTo(i, Dao) 
 aList.Add(dtoDANGKYHOC)
 Next 
 Return aList 
 End Function
 Public Function LayBangTableSQL(ByVal sql As string) As DataTable
 Dim Dao As New  AbstractDao(sql,sql,ketnoi)
 Return Dao
 End Function
 Public Sub suaIDHOCSINH( ByVal IDHOCSINH as System.Int32, ByVal IDDANGKYHOC As System.Int32 )
 Dim dao As New DANGKYHOCDao(ketnoi)
 dao.suaIDHOCSINH(IDHOCSINH,IDDANGKYHOC)
 End Sub 
 Public Sub suaIDLOPHOC( ByVal IDLOPHOC as System.Int32, ByVal IDDANGKYHOC As System.Int32 )
 Dim dao As New DANGKYHOCDao(ketnoi)
 dao.suaIDLOPHOC(IDLOPHOC,IDDANGKYHOC)
 End Sub 
 Public Sub suaTRANGTHAI( ByVal TRANGTHAI as System.Int32, ByVal IDDANGKYHOC As System.Int32 )
 Dim dao As New DANGKYHOCDao(ketnoi)
 dao.suaTRANGTHAI(TRANGTHAI,IDDANGKYHOC)
 End Sub 
    Public Sub suaGHICHU(ByVal GHICHU As System.String, ByVal IDDANGKYHOC As System.Int32)
        Dim dao As New DANGKYHOCDao(ketnoi)
        dao.SuaGHICHU(GHICHU, IDDANGKYHOC)
    End Sub
 Public Function LayBangTable( ByVal IDDANGKYHOC As System.Int32) As DataTable
 Dim Dao As New DANGKYHOCDao(IDDANGKYHOC,ketnoi)
 Return Dao
 End Function
 Public Function LayBangTableIlist( ByVal IDDANGKYHOC As System.Int32) As IList
 Dim Dao As New DANGKYHOCDao(IDDANGKYHOC,ketnoi)
 Dim aList As New ArrayList 
 For i As Integer = 0 To Dao.Rows.Count - 1 
 Dim dtoDANGKYHOC As DANGKYHOCdto = LayBangDTo(i, Dao) 
 aList.Add(dtoDANGKYHOC)
 Next 
 Return aList 
 End Function
 Public Function LayBangTableTheoIDDANGKYHOC (ByVal IDDANGKYHOC As System.Int32) As DataTable
 Dim Dao As New DANGKYHOCDao(ketnoi)
 Dao.layBangTheoIDDANGKYHOC(IDDANGKYHOC)
 Return Dao
 End Function
 Public Function LayBangTableTheoIDDANGKYHOC (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New DANGKYHOCDao(ketnoi)
 Dao.layBangTheoIDDANGKYHOC(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoIDDANGKYHOC (ByVal IDDANGKYHOC As System.Int32) 
 Dim Dao As New DANGKYHOCDao(ketnoi)
 Dao.XOABangTheoIDDANGKYHOC(IDDANGKYHOC)
 End sub
 Public Function LayBangTableTheoIDHOCSINH (ByVal IDHOCSINH As System.Int32) As DataTable
 Dim Dao As New DANGKYHOCDao(ketnoi)
 Dao.layBangTheoIDHOCSINH(IDHOCSINH)
 Return Dao
 End Function
 Public Function LayBangTableTheoIDHOCSINH (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New DANGKYHOCDao(ketnoi)
 Dao.layBangTheoIDHOCSINH(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoIDHOCSINH (ByVal IDHOCSINH As System.Int32) 
 Dim Dao As New DANGKYHOCDao(ketnoi)
 Dao.XOABangTheoIDHOCSINH(IDHOCSINH)
 End sub
 Public Function LayBangTableTheoIDLOPHOC (ByVal IDLOPHOC As System.Int32) As DataTable
 Dim Dao As New DANGKYHOCDao(ketnoi)
 Dao.layBangTheoIDLOPHOC(IDLOPHOC)
 Return Dao
 End Function
 Public Function LayBangTableTheoIDLOPHOC (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New DANGKYHOCDao(ketnoi)
 Dao.layBangTheoIDLOPHOC(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoIDLOPHOC (ByVal IDLOPHOC As System.Int32) 
 Dim Dao As New DANGKYHOCDao(ketnoi)
 Dao.XOABangTheoIDLOPHOC(IDLOPHOC)
 End sub
 Public Function LayBangTableTheoTRANGTHAI (ByVal TRANGTHAI As System.Int32) As DataTable
 Dim Dao As New DANGKYHOCDao(ketnoi)
 Dao.layBangTheoTRANGTHAI(TRANGTHAI)
 Return Dao
 End Function
 Public Function LayBangTableTheoTRANGTHAI (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New DANGKYHOCDao(ketnoi)
 Dao.layBangTheoTRANGTHAI(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoTRANGTHAI (ByVal TRANGTHAI As System.Int32) 
 Dim Dao As New DANGKYHOCDao(ketnoi)
 Dao.XOABangTheoTRANGTHAI(TRANGTHAI)
 End sub

 Public Function LayBangTableTheoGHICHU (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New DANGKYHOCDao(ketnoi)
 Dao.layBangTheoGHICHU(ARRAY1)
 Return Dao
 End Function
    Public Sub XOAbangTableTheoGHICHU(ByVal GHICHU As System.String)
        Dim Dao As New DANGKYHOCDao(ketnoi)
        Dao.XOABangTheoGHICHU(GHICHU)
    End Sub
 Public Function LayBangDTo( ByVal IDDANGKYHOC As System.Int32) As DANGKYHOCdto
 Dim Dao As New DANGKYHOCDao(IDDANGKYHOC, ketnoi)
 Dim dto As New DANGKYHOCdto
 If Dao.Rows.Count<= 0 then Return dto
 Try
 If IsDBNull(Dao.Rows(0)("IDDANGKYHOC")) = False Then
 Dto.IDDANGKYHOC = Dao.Rows(0)("IDDANGKYHOC")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("DANGKYHOC.IDDANGKYHOC")) = False Then
 Dto.IDDANGKYHOC = Dao.Rows(0)("DANGKYHOC.IDDANGKYHOC")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("IDHOCSINH")) = False Then
 Dto.IDHOCSINH = Dao.Rows(0)("IDHOCSINH")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("DANGKYHOC.IDHOCSINH")) = False Then
 Dto.IDHOCSINH = Dao.Rows(0)("DANGKYHOC.IDHOCSINH")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("IDLOPHOC")) = False Then
 Dto.IDLOPHOC = Dao.Rows(0)("IDLOPHOC")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("DANGKYHOC.IDLOPHOC")) = False Then
 Dto.IDLOPHOC = Dao.Rows(0)("DANGKYHOC.IDLOPHOC")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("TRANGTHAI")) = False Then
 Dto.TRANGTHAI = Dao.Rows(0)("TRANGTHAI")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("DANGKYHOC.TRANGTHAI")) = False Then
 Dto.TRANGTHAI = Dao.Rows(0)("DANGKYHOC.TRANGTHAI")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("GHICHU")) = False Then
 Dto.GHICHU = Dao.Rows(0)("GHICHU")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("DANGKYHOC.GHICHU")) = False Then
 Dto.GHICHU = Dao.Rows(0)("DANGKYHOC.GHICHU")
 End if
Catch ex As Exception
End Try
 Return dto
 end function
 Public Function LayBangDTo(ByVal i As Integer, ByVal dao As DataTable) As DANGKYHOCdto
 Dim dto As New DANGKYHOCdto
 If Dao.Rows.Count<=0 then Return dto
 Try
 If IsDBNull(Dao.Rows(i)("IDDANGKYHOC")) = False Then
 Dto.IDDANGKYHOC = Dao.Rows(i)("IDDANGKYHOC")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("DANGKYHOC.IDDANGKYHOC")) = False Then
 Dto.IDDANGKYHOC = Dao.Rows(i)("DANGKYHOC.IDDANGKYHOC")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("IDHOCSINH")) = False Then
 Dto.IDHOCSINH = Dao.Rows(i)("IDHOCSINH")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("DANGKYHOC.IDHOCSINH")) = False Then
 Dto.IDHOCSINH = Dao.Rows(i)("DANGKYHOC.IDHOCSINH")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("IDLOPHOC")) = False Then
 Dto.IDLOPHOC = Dao.Rows(i)("IDLOPHOC")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("DANGKYHOC.IDLOPHOC")) = False Then
 Dto.IDLOPHOC = Dao.Rows(i)("DANGKYHOC.IDLOPHOC")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("TRANGTHAI")) = False Then
 Dto.TRANGTHAI = Dao.Rows(i)("TRANGTHAI")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("DANGKYHOC.TRANGTHAI")) = False Then
 Dto.TRANGTHAI = Dao.Rows(i)("DANGKYHOC.TRANGTHAI")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("GHICHU")) = False Then
 Dto.GHICHU = Dao.Rows(i)("GHICHU")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("DANGKYHOC.GHICHU")) = False Then
 Dto.GHICHU = Dao.Rows(i)("DANGKYHOC.GHICHU")
 End if
 Catch ex As Exception
 End Try
 Return dto
 end function
 Public Function LayBangDTo(ByVal dong As Integer, ByVal dao As DataGridView) As DANGKYHOCdto
 Dim dto As New DANGKYHOCdto
 If dao.Rows.Count <= 0 Then Return dto
 For cot As Integer = 0 To dao.Columns.Count - 1
 Try
 Dto.HoTro(dao.Columns(cot).DataPropertyName, dao.Item(cot, dong).Value)
 Catch ex As Exception
 End Try
 Next
 Return Dto
 End Function
 Public Function layBangNhieuTable() as Datatable
 Dim Dao As New DANGKYHOCDao(ketnoi)
 Dao.layBangNhieuTable()
 Return Dao
 End Function
 Public Sub Taotable()
 Dim Dao As New DANGKYHOCDao(ketnoi)
 Dao.TaoTable()
    End Sub
#Region "VIET"
    Public Function layDanHSachHocSInh(ByVal lophoc As System.Int32) As DataTable
        Dim Dao As New DANGKYHOCDao(ketnoi)
        Dao.layDanHSachHocSInh(lophoc)
        Return Dao
    End Function
    Public Function layDanHSachMonHoc(ByVal caphoc As System.Int32) As DataTable
        Dim Dao As New DANGKYHOCDao(ketnoi)
        Dao.layDanHSachMonHoc(caphoc)
        Return Dao
    End Function
    Public Function layDanHSachGiaoVien(ByVal lophoc As System.Int32) As DataTable
        Dim Dao As New DANGKYHOCDao(ketnoi)
        Dao.layDanHSachGiaoVien(lophoc)
        Return Dao
    End Function
    Public Function layDanhSachPhong(ByVal lophoc As System.Int32) As DataTable
        Dim Dao As New DANGKYHOCDao(ketnoi)
        Dao.layDanhSachPhong(lophoc)
        Return Dao
    End Function
    Public Function LayDanhSachHocSInhChuaTUngCoLop() As DataTable
        Dim Dao As New DANGKYHOCDao(ketnoi)
        Dao.LayDanhSachHocSInhChuaTUngCoLop()
        Return Dao
    End Function
#End Region
 End Class

